/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package unc.pds.facets;

import unc.pds.model.GroupRemote;
import unc.pds.model.UserRemote;

/**
 *
 * @author Mikhail
 */
public class NewMembersFacet implements Facet {
    public NewMembersFacet(GroupRemote group) {
        this.group = group;
    }
    GroupRemote group;
    public String draw() throws Exception {
        String result = "";
        UserRemote[] users = group.getNewMembers();
        result += "<h4>Новые члены:</h4>";
        for (int i=0; i<users.length; i++) {
            result += "<p><a href = \"index.jsp?id="+ users[i].getKey() +"&view=posts\">"+ users[i].getNickname() +"</a>"
                    + " <a href = \"group-processor.jsp?action=acceptmember&id="+ users[i].getKey() +"&gid="+ group.getKey() +"\"><img src=\"img/accept.png\" alt=\"Принять\"/></a>"
                    + " <a href = \"group-processor.jsp?action=declinemember&id="+ users[i].getKey() +"&gid="+ group.getKey() +"\"><img src=\"img/decline.png\" alt=\"Отклонить\"/></a></p>\n";
        }
        return result;
    }
    public boolean isSide() {
        return false;
    }
}